#!/bin/sh

# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# If there's an external display connected, runs the monitor_reconfigure
# command to choose a screen resolution.

XRANDR=/usr/bin/xrandr
MONITOR_RECONFIGURE=/usr/bin/monitor_reconfigure

# Always exit with 0
trap "exit 0" EXIT
set -e

NUM_OUTPUTS=$($XRANDR | grep -c ' connected')
if [ "$NUM_OUTPUTS" -gt 1 ]; then
  $MONITOR_RECONFIGURE
fi
